﻿using MediatR;
using S_Gridding.Domains.BasicData;
using S_Gridding.Infrastructure.Interface;
using S_Gridding.Read.Api.Command.AssemType;

namespace S_Gridding.Read.Api.CommandHands.AssemType
{
    /// <summary>
    /// 反填事件类类型表
    /// </summary>
    public class BackAssemTypeCommandHander : IRequestHandler<BackAssemTypeCommand, AssemTypeInfo>
    {
        private readonly IDapperAssemTypeRepository _assemTypeRepository;

        public BackAssemTypeCommandHander(IDapperAssemTypeRepository assemTypeRepository)
        {
            _assemTypeRepository = assemTypeRepository;
        }
        public async Task<AssemTypeInfo> Handle(BackAssemTypeCommand request, CancellationToken cancellationToken)
        {
            string sql = "select * from AssemTypeInfo where AssemTypeId=@Id";
            return await _assemTypeRepository.GetOne(request.AssemTypeId,sql);
        }
    }
}
